import 'package:dartkit/dartkit.dart';
import 'package:test/test.dart';

void main() {
  test("序列化与反序列化测试", () {
    final sms = Sms.create(expireTime: Duration(minutes: 10));
    final user = User(
      id: 1,
      nick: "a",
      isAdmin: false,
      sms: sms,
      phone: "123456",
    );
    final recover = User.fromRaw(user.toJson());
    expect(recover.id, user.id);
    expect(recover.nick, user.nick);
    expect(recover.isAdmin, user.isAdmin);
    expect(recover.phone, user.phone);
    expect(recover.sms?.code, sms.code);
  });
}
